<div class="verify-pop order-verify-hidden" style="color: #fff">
    <div class="fui-modal picker-modal in">
        <div class="option-picker" style="max-height: 577px;">
            <div class="option-picker-inner">
                <div class="option-picker-cell goodinfo">
                    <div class="closebtn"><i class="icon icon-roundclose"></i></div>
                    <div class="img"><img class="thumb" src="{php echo tomedia($goods['thumb']);}"></div>
                    <div class="info info-price text-danger"><span>￥<span class="price">{$goods['minprice']}~{$goods['maxprice']}</span></span></div>
                    <div class="info info-total">

                    </div>
                    <div class="info info-titles">请选择规格(可多选)</div>
                </div>
            <div class="option-picker-options" style="max-height: 400px;">
                <div class="option-picker-cell option spec">
                    <div class="select">
                        <input type="hidden" name="data" value="{$yx0}">
                        <input type="hidden" name="count" value="{php echo count($yx_arr);}">
                        <input type="hidden" name="old_count" value="{php echo count($yx_arr);}">
                        <input type="hidden" name="price" value="0">
                        {loop $option $k $v}
                        <button href="javascript:;"
                           {if !empty($yx_arr) && in_array($v['id'],$yx_arr)}
                        class="btn btn-danger btn-sm nav spec-item" data-id="{$v['id']}" type="danger"
                        {else}class="btn btn-default btn-sm nav spec-item" data-id="{$v['id']}" type="default"
                        {/if} value="{$v['marketprice']}"> {$v['title']} </button>
                        {/loop}
                    </div>
                </div>
            </div>
            <div class="fui-navbar">
                <a href="javascript:;" class="nav-item btn cartbtn">取消</a>
                <a href="javascript:;" class="nav-item btn confirmbtn xuanhaole">选好了</a>
            </div>
        </div>
    </div>
    </div>
</div>



<script type="text/javascript">

    $(function () {
        var count = $("input[name = 'count']").val();
        if (count>0){
            $(".info-titles").html('已选择'+count+'件商品');
        }else{
            $(".info-titles").html('请选择规格(可多选)');
        }
        var aaa = [];
        for (var i=0,l=optionsss.length;i<l;i++){
            aaa.push(optionsss[i]);
        }
        optionArr = aaa;
        $(document).ready(function () {
            var a = $('.spec-item');
            a.click(function () {
                if($(this).attr('type') == 'default'){
                    $(this).removeClass('btn-default').addClass('btn-danger').attr('type','danger');
                    count++;
                    $("input[name='count']").val(count);
                    if (count>0){
                        $(".info-titles").html('已选择'+count+'件商品');
                    }else{
                        $(".info-titles").html('请选择规格(可多选)');
                    }
                    var data = $("input[name='data']").val();
                    data = data + '_' + $(this).attr('data-id');
                    $("input[name='data']").val(data);
                    optionArr.push([$(this).attr('data-id'),$(this).attr('value')]);
                }else{
                    var i;
                    for(i=0;i<optionArr.length;i++){
                        if (optionArr[i][0] == $(this).attr('data-id')){
                            optionArr.splice(i,1);
                            break;
                        }else{
                            continue;
                        }
                    }
                    $(this).removeClass('btn-danger').addClass('btn-default').attr('type','default');
                    count--;
                    $("input[name='count']").val(count);
                    if (count>0){
                        $(".info-titles").html('已选择'+count+'件商品');
                    }else{
                        $(".info-titles").html('请选择规格(可多选)');
                    }
                    var data = $("input[name='data']").val();
                    var re = '_'+ $(this).attr("data-id");
                    data = data.replace(re,'');
                    $("input[name='data']").val(data);
                }
            });
        });
    });
</script>